package com.gemcoder.system.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.Map;
import javax.annotation.Resource;
import com.gemcoder.system.bo.Result;
import com.gemcoder.system.service.PersonnelschedulingService;
import cn.hutool.core.util.StrUtil;
import java.util.Map;
import cn.hutool.core.util.ObjectUtil;

@Controller
@RequestMapping("/Personnelscheduling")
public class PersonnelschedulingController {

    @Resource
    private PersonnelschedulingService PersonnelschedulingService;

    @RequestMapping(value = "/getSchedulingInfo")
    @ResponseBody
    public Result getSchedulingInfo(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return PersonnelschedulingService.getSchedulingInfo(paramMap);
    }

    @RequestMapping(value = "/getShiftScheduling")
    @ResponseBody
    public Result getShiftScheduling(@RequestBody(required = false) Map<String, Object> paramMap) {
        // 校验 ProjectNamevalue1 是否存在且不为空
        if (paramMap.get("ProjectNamevalue1") == null || String.valueOf(paramMap.get("ProjectNamevalue1")).isEmpty()) {
            return new Result(false, "ProjectNamevalue1 必填", null);
        }
        // 校验 Monthsvalue1 是否存在且不为空
        if (paramMap.get("Monthsvalue1") == null || String.valueOf(paramMap.get("Monthsvalue1")).isEmpty()) {
            return new Result(false, "Monthsvalue1 必填", null);
        }
        //调用service层的代码
        return PersonnelschedulingService.getShiftScheduling(paramMap);
    }

    @RequestMapping(value = "/getAllUsers")
    @ResponseBody
    public Result getAllUsers(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return PersonnelschedulingService.getAllUsers(paramMap);
    }

    @RequestMapping(value = "/getAllUsersCVE")
    @ResponseBody
    public Result getAllUsersCVE(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return PersonnelschedulingService.getAllUsersCVE(paramMap);
    }

    @RequestMapping(value = "/getAllUsers17V")
    @ResponseBody
    public Result getAllUsers17V(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return PersonnelschedulingService.getAllUsers17V(paramMap);
    }

    @RequestMapping(value = "/syncLastMonthScheduling")
    @ResponseBody
    public Result syncLastMonthScheduling(@RequestBody(required = false) Map<String, Object> paramMap) {
        // 校验 ProjectNamevalue1 是否存在且不为空
        if (paramMap.get("ProjectNamevalue1") == null || String.valueOf(paramMap.get("ProjectNamevalue1")).isEmpty()) {
            return new Result(false, "请先选择一个项目", null);
        }
        // 校验 Monthsvalue1 是否存在且不为空
        if (paramMap.get("Monthsvalue1") == null || String.valueOf(paramMap.get("Monthsvalue1")).isEmpty()) {
            return new Result(false, "请先选择一个月份", null);
        }
        //调用service层的代码
        return PersonnelschedulingService.syncLastMonthScheduling(paramMap);
    }

    @RequestMapping(value = "/getAllProjects")
    @ResponseBody
    public Result getAllProjects(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return PersonnelschedulingService.getAllProjects(paramMap);
    }
}
